<test>
  <sql>SELECT  EmployeeID
FROM    Employees e
WHERE   e.EmployeeID = 9999
OR      NOT EXISTS (
            SELECT  *
            FROM    Employees ie
            WHERE   ie.ReportsTo = e.EmployeeID
        )
ORDER	BY 1</sql>
  <expectedResults>
    <NewDataSet>
  <xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table1">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="EmployeeID" type="xs:int" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Table1>
    <EmployeeID>1</EmployeeID>
  </Table1>
  <Table1>
    <EmployeeID>3</EmployeeID>
  </Table1>
  <Table1>
    <EmployeeID>4</EmployeeID>
  </Table1>
  <Table1>
    <EmployeeID>6</EmployeeID>
  </Table1>
  <Table1>
    <EmployeeID>7</EmployeeID>
  </Table1>
  <Table1>
    <EmployeeID>8</EmployeeID>
  </Table1>
  <Table1>
    <EmployeeID>9</EmployeeID>
  </Table1>
</NewDataSet>
  </expectedResults>
  <expectedPlan>
    <executionPlan>
      <element operator="Select">
        <properties>
          <property name="Output List.[0]" value="e.EmployeeID AS EmployeeID" />
          <property name="Output List.[0].Table" value="e" />
          <property name="Output List.[0].Column" value="EmployeeID" />
          <property name="Output List.[0].DataType" value="Int32" />
          <property name="Output List.[0].Output Name" value="EmployeeID" />
        </properties>
        <input>
          <element operator="Sort">
            <properties>
              <property name="Output List.[0]" value="e.EmployeeID" />
              <property name="Output List.[0].Table" value="e" />
              <property name="Output List.[0].Column" value="EmployeeID" />
              <property name="Output List.[0].DataType" value="Int32" />
              <property name="Statistics.Open Count" value="1" />
              <property name="Statistics.Row Count" value="7" />
              <property name="Statistics.Average Row Count" value="7" />
              <property name="Logical Operator" value="Sort" />
              <property name="Order By.[0]" value="e.EmployeeID ASC" />
              <property name="Order By.[0].Table" value="e" />
              <property name="Order By.[0].Column" value="EmployeeID" />
              <property name="Order By.[0].DataType" value="Int32" />
              <property name="Order By.[0].Order" value="ASC" />
            </properties>
            <input>
              <element operator="NestedLoops">
                <properties>
                  <property name="Output List.[0]" value="e.EmployeeID" />
                  <property name="Output List.[0].Table" value="e" />
                  <property name="Output List.[0].Column" value="EmployeeID" />
                  <property name="Output List.[0].DataType" value="Int32" />
                  <property name="Logical Operator" value="Left Semi Join" />
                  <property name="Statistics.Open Count" value="1" />
                  <property name="Statistics.Row Count" value="7" />
                  <property name="Statistics.Average Row Count" value="7" />
                  <property name="Outer References.[0]" value="e.EmployeeID" />
                  <property name="Outer References.[0].Table" value="e" />
                  <property name="Outer References.[0].Column" value="EmployeeID" />
                  <property name="Outer References.[0].DataType" value="Int32" />
                </properties>
                <input>
                  <element operator="TableScan">
                    <properties>
                      <property name="Table" value="Employees AS e" />
                      <property name="Output List.[0]" value="e.EmployeeID" />
                      <property name="Output List.[0].Table" value="e" />
                      <property name="Output List.[0].Column" value="EmployeeID" />
                      <property name="Output List.[0].DataType" value="Int32" />
                      <property name="Statistics.Open Count" value="1" />
                      <property name="Statistics.Row Count" value="9" />
                      <property name="Statistics.Average Row Count" value="9" />
                    </properties>
                    <input />
                  </element>
                  <element operator="Concatenation">
                    <properties>
                      <property name="Statistics.Open Count" value="9" />
                      <property name="Statistics.Row Count" value="7" />
                      <property name="Statistics.Average Row Count" value="1" />
                    </properties>
                    <input>
                      <element operator="Filter">
                        <properties>
                          <property name="Statistics.Open Count" value="9" />
                          <property name="Statistics.Row Count" value="0" />
                          <property name="Statistics.Average Row Count" value="0" />
                          <property name="Predicate" value="e.EmployeeID = 9999" />
                        </properties>
                        <input>
                          <element operator="ConstantScan">
                            <properties>
                              <property name="Empty" value="False" />
                              <property name="Statistics.Open Count" value="9" />
                              <property name="Statistics.Row Count" value="9" />
                              <property name="Statistics.Average Row Count" value="1" />
                            </properties>
                            <input />
                          </element>
                        </input>
                      </element>
                      <element operator="NestedLoops">
                        <properties>
                          <property name="Logical Operator" value="Left Anti Semi Join" />
                          <property name="Statistics.Open Count" value="9" />
                          <property name="Statistics.Row Count" value="7" />
                          <property name="Statistics.Average Row Count" value="1" />
                        </properties>
                        <input>
                          <element operator="ConstantScan">
                            <properties>
                              <property name="Empty" value="False" />
                              <property name="Statistics.Open Count" value="9" />
                              <property name="Statistics.Row Count" value="9" />
                              <property name="Statistics.Average Row Count" value="1" />
                            </properties>
                            <input />
                          </element>
                          <element operator="IndexSpool">
                            <properties>
                              <property name="Statistics.Open Count" value="9" />
                              <property name="Statistics.Row Count" value="2" />
                              <property name="Statistics.Average Row Count" value="0" />
                              <property name="Logical Operator" value="Eager Spool" />
                              <property name="With Stack" value="False" />
                              <property name="Index" value="ie.ReportsTo" />
                              <property name="Index.Table" value="ie" />
                              <property name="Index.Column" value="ReportsTo" />
                              <property name="Index.DataType" value="Int32" />
                              <property name="Probe" value="e.EmployeeID" />
                            </properties>
                            <input>
                              <element operator="TableScan">
                                <properties>
                                  <property name="Table" value="Employees AS ie" />
                                  <property name="Output List.[0]" value="ie.ReportsTo" />
                                  <property name="Output List.[0].Table" value="ie" />
                                  <property name="Output List.[0].Column" value="ReportsTo" />
                                  <property name="Output List.[0].DataType" value="Int32" />
                                  <property name="Statistics.Open Count" value="1" />
                                  <property name="Statistics.Row Count" value="9" />
                                  <property name="Statistics.Average Row Count" value="9" />
                                </properties>
                                <input />
                              </element>
                            </input>
                          </element>
                        </input>
                      </element>
                    </input>
                  </element>
                </input>
              </element>
            </input>
          </element>
        </input>
      </element>
    </executionPlan>
  </expectedPlan>
</test>